#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        //child process
        int cnt = 5;
        while(cnt)
        {
            printf("子进程运行%d...\n", cnt);
            sleep(1);
            cnt--;
        }
    }
    else
    {
        while(1)
        {
            printf("父进程运行...\n");
            sleep(1);
        }
    }

    //printf("这是一个进程，pid：%d\n", getpid());

    //int x;
    //scanf("%d", &x);
    //while(1)
    //{
    //    printf("hello world!\n");
    //    //printf("我的pid为：%d\n", getpid());
    //}
    return 0;
}
